//
//  XVVNewUserSeeButton.m
//  ppkc2016
//
//  Created by 拼凑的断音 on 16/4/11.
//  Copyright © 2016年 拼凑的断音. All rights reserved.
//

#import "XVVNewUserSeeButton.h"
#import "XXTool.h"

@interface XVVNewUserSeeButton ()

@property (nonatomic) UIView *contentBackground;

@property (nonatomic) UILabel *tipLabel;

@property (nonatomic) UIImageView *rightIcon;

@end

@implementation XVVNewUserSeeButton
-(UIView*)contentBackground
{
    if (_contentBackground==nil)
    {
        _contentBackground = [[UIView alloc] init];
        _contentBackground.backgroundColor = [UIColor whiteColor];
        _contentBackground.layer.shadowOpacity = 1;
        _contentBackground.layer.shadowColor = [UIColor colorWithRed:214/255.0 green:215/255.0 blue:216/255.0 alpha:1.0].CGColor;
        _contentBackground.layer.shadowOffset = CGSizeMake(0,1);
        _contentBackground.layer.shadowRadius = 2;
        _contentBackground.layer.masksToBounds = NO;
        //_contentBackground.layer.shadowPath = [UIBezierPath bezierPathWithRect:_contentBackground.layer.bounds].CGPath;
        [self addSubview:_contentBackground];
    }
    return _contentBackground;
}

-(UILabel*)tipLabel
{
    if (_tipLabel==nil)
    {
        _tipLabel = [[UILabel alloc] init];
        _tipLabel.textColor = [XXTool colorWithProject];
        _tipLabel.text = NSLocalizedString(@"又有新的用户看过你的商品", nil);
        _tipLabel.font = [XXTool boldSystemFontOfSize:15];
        [_contentBackground addSubview:_tipLabel];
    }
    return _tipLabel;
}

-(UIImageView*)rightIcon
{
    if (_rightIcon==nil)
    {
        _rightIcon = [[UIImageView alloc] init];
        _rightIcon.image = [UIImage imageNamed:@"绿箭头"];
        _rightIcon.contentMode = UIViewContentModeScaleAspectFit;
        [_contentBackground addSubview:_rightIcon];
    }
    return _rightIcon;
}

-(void)initParameter
{

}

-(void)initUI
{
    
}

-(void)refreshLayout:(CGRect)frame
{
    self.contentBackground.frame = CGRectMake(0, 0, frame.size.width
                                              , 50);
    self.tipLabel.frame = CGRectMake(20
                                     , 0
                                     , frame.size.width-20-33
                                     , _contentBackground.frame.size.height);
    
    self.rightIcon.frame = CGRectMake(_tipLabel.frame.size.width+_tipLabel.frame.origin.x
                                      , (50-15)/2
                                      , 10
                                      , 15);
}

+(CGFloat)heightForNewUserSeeButton
{
    return 54;
}

@end
